<?php 

/**
* 
*/
class AdminModel extends Model
{
    /**
     * 验证用户名密码
     * @param  [type] $username [description]
     * @param  [type] $password [description]
     * @return [type]           [description]
     */
    public function validateUser($username,$password)
    {
        $map = array();
        $map['username'] = $username;
        $map['password'] = md5($password);
        $re = $this->where($map)->find();
        return $re ? $re : array();
    }

    public function userExist($username)
    {
        $map['username'] = $username;
        $re = $this->where($map)->count();

        return $re>0 ? true:false;
    }
}
 ?>